package org.dinner.order.service.impl;

import java.util.List;

import org.dinner.order.dao.DishDAO;
import org.dinner.order.model.Dish;
import org.dinner.order.service.DishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class DishServiceImpl implements DishService {

	@Autowired
	private DishDAO dishDAO;
	
	@Transactional
	public Dish add(Dish item) {
		return dishDAO.add(item);
	}

	@Transactional
	public List<Dish> list() {
		return dishDAO.list();
	}

	@Transactional
	public Dish getById(int id) {
		return dishDAO.getById(id);
	}

	@Transactional
	public void remove(int id) {
		dishDAO.remove(id);
	}

	@Transactional
	public List<Dish> listByType(int typeId) {
		return null;
	}

	@Transactional
	public Dish getByName(String name) {
		return dishDAO.getByName(name);
	}

	@Transactional
	public Dish createDish(String name, int typeId, double price,
			boolean isComplex) {
		return dishDAO.createDish(name, typeId, price, isComplex);
	}

}
